#include "jsoncpp/json/json.h"
#include <iostream>
#include <string>

int main(){
    Json::Value root;
    
    root["name"] = "张三";
    root["type"] = "int";
    root["sex"] = "man";
    root["age"] = 32;
    
    Json::FastWriter w;
    std::string res = w.write(root);
    
    std::cout << res << std::endl;

    std::cout << "提取字符串" << std::endl;
    Json::Value v;
    Json::Reader r;
    r.parse(res, v);

    std::cout << "name : " << v["name"] << std::endl;
    std::cout << "type : " << v["type"] << std::endl;
    std::cout << "sex : " << v["sex"] << std::endl;
    std::cout << "age : " << v["age"].asInt() << std::endl;

    return 0;
}